home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: news.duc.auburn.edu!mallard!greerjo
- From: greerjo@mail.auburn.edu (John M. Greer)
- Subject: Why does this work?
- Message-ID: <DoxvnA.L0C@mail.auburn.edu>
- Sender: usenet@mail.auburn.edu (Usenet Administrator)
- Nntp-Posting-Host: mallard2.duc.auburn.edu
- Organization: Auburn University
- X-Newsreader: TIN [version 1.2 PL2]
- Date: Wed, 27 Mar 1996 18:35:33 GMT
-
- This is probably a horribly simple question, but I was going through a
- few books, brushing up on my iostreams, when I saw this tidbit in Jamsa's
- Multimedia Trilogy (The CD-ROM by Kris Jamsa)
-
- #include <iostream.h>
- #include <ctype.h>
-
- void main(void)
- {
- char letter;
-
- while (! cin.eof())
- {
- letter = cin.get();
- letter = toupper(letter);
- cout << letter;
- }
- }
-
- Why does this work!?!? It seems to reserve storage for only one
- character in letter, but outputs a whole line at a time. Feel free to
- flame my stupidity, but please satisfy my curiosity (I'm really not this
- clueless, I promise!!)
-
- John Greer
-